from enum import Enum

from PySide6.QtGui import QIcon, QMovie, QPixmap, QImage

from .settings import RESOURCE_DIR


class IconBaseEnum(Enum):
    def path(self):
        raise NotImplementedError()

    def icon(self):
        return QIcon(self.path())

    def movie(self):
        return QMovie(self.path())

    def pixmap(self):
        return QPixmap(self.path())

    def image(self):
        return QImage(self.path())


class Icon(IconBaseEnum):
    PLAY = 'Play'
    PAUSE = 'Pause'
    VOLUME = 'Volume'
    MUTE = 'Mute'
    SKIP_BACK = 'SkipBack'
    SKIP_FORWARD = 'SkipForward'
    FULLSCREEN = 'Fullscreen'
    BACK_TO_WINDOW = 'BackToWindow'
    PLAYER = 'Player'

    def path(self):
        return (RESOURCE_DIR / f'icons/{self.value}.svg').as_posix()


class GifIcon(IconBaseEnum):
    LOADING = 'loading'

    def path(self):
        return (RESOURCE_DIR / f'gif/{self.value}.gif').as_posix()
